package com.example.test.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.test.service.IFaceRecognitionService;
import com.example.test.utils.RequestJsonUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @program: programme
 * @description: 人脸识别业务层
 * @author: qiu bo yang
 * @create: 2020-10-09 11:21
 **/
@Slf4j
@RestController
@RequestMapping("/person")
public class FaceRecognitionPersonController {
    @Autowired
    private IFaceRecognitionService faceRecognitionService;

    /**
     * 设备人员命令
     *
     * @param request
     * @param response
     */
    @PostMapping("/cmd")
    public void personCmd(HttpServletRequest request, HttpServletResponse response) {
        faceRecognitionService.personCmd(request, response);
    }

    /**
     * 人员命令执行结果通知
     *
     * @param request
     * @param response
     */
    @PostMapping("/result")
    public void personResult(HttpServletRequest request, HttpServletResponse response) {
        JSONObject jsonObject = RequestJsonUtils.getRequestJsonObject(request);
        log.info("personResult请求数据：{}", jsonObject);
    }

}
